/**
 * 
 */
package leetCode;

/**
 * @author zhongfang
 *
 */
public class IntegerBreak {
    public int integerBreak(int n) {
        int[] dp=new int[n+1];
        dp[1]=1;
        for (int i = 2; i <= n; i++) {
			for (int j = 1; j <= i/2; j++) {
				dp[i]=Math.max(dp[i], dp[i-j]*dp[j]);
				dp[i]=Math.max(dp[i], dp[i-j]*j);
				dp[i]=Math.max(dp[i], (i-j)*dp[j]);
				dp[i]=Math.max(dp[i], (i-j)*j);
			}
		}
        return dp[n];
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int n=10;
		System.out.println(new IntegerBreak().integerBreak(n));
	}

}
